#pragma once
#include "hzpch.h"

/*
 * 正交相机
 * */
namespace Hazel {

    class OrthographicCamera {
    public:
        // 这几个参数代表摄像机大小,比如800*600 glm::ortho(0.0f, 800.0f, 0.0f, 600.0f, 0.1f, 100.0f); 最后两个参数是距离
        OrthographicCamera(float left, float right, float bottom, float top);

        const glm::vec3& GetPosition() const {return m_Position;}
        void SetPosition(const glm::vec3& position){
            m_Position = position;
            RecalculateViewMatrix();
        }

        float GetRotation() const {return m_Rotation;}
        void SetRotation(float rotation) {
            m_Rotation = rotation;
            RecalculateViewMatrix();
        }

        const glm::mat4& GetProjectionMatrix() const {return m_ProjectionMatrix;}
        const glm::mat4& GetViewMatrix() const {return m_ViewMatrix;}
        const glm::mat4& GetViewProjectionMatrix() const {return m_ViewProjectionMatrix;}

        void SetProjection(float left, float right, float bottom, float top);

    private:
        //计算 ViewMatrix
        void RecalculateViewMatrix();
    private:
        // Projection = 投影 // 正交投影矩阵
        glm::mat4 m_ProjectionMatrix;
        // 相机变换矩阵  // 相机的旋转状态描述 + 位置状态描述 //glm::lookAt(eye:相机在世界坐标位置,center 相机看向世界坐标的目标点,top站立或倒立)
        glm::mat4 m_ViewMatrix;
        // 变换矩阵 = m_ProjectionMatrix * m_ViewMatrix
        glm::mat4 m_ViewProjectionMatrix;
        // eye 相机世界坐标位置
        glm::vec3 m_Position = {0.0f, 0.0f, 0.0f};
        float m_Rotation = 0.0f;
    };

}

